Dynomotion

Group: DynoMotion Message: 10537 From: cnc_machines Date: 11/21/2014
Subject: Spindle Control
Greetings,

I am in the process of trying to figure out how to set up my spindle to have variable speed through the G-Code program. I am using the K-Step. Here is what I am doing so far:

  1. Connect the K-Step to the potentiometer input on the brushless DC motor controller
  2. Paste the sample C program for spindle control into the intit file

A few questions on next steps

  1. Do I use the Tool Setup screen to configure the M-Code to the correct DAC?
  2. The max motor speed is 3,200 RPM - How do I configure the scale, offset, min, and max values for the G-Code to hit the target speed?
  3. My motor driver provides 4 pulses per revolution - How do I monitor actual motor speed?
  4. Is there any active control if the spindle is under load to increase the power to hit the desired RPM?


Thanks,


Scott



Group: DynoMotion Message: 10539 From: Tom Kerekes Date: 11/21/2014
Subject: Re: Spindle Control
Attachments :
    Hi Scott,

    Not sure what program you are pasting into the init C program but that doesn't sound correct.

    To do simple open loop Speed Control with KSTEP you would configure KMotionCNC's S code to use: Spindle_S_Kstep.c

    Configure to use Exec Prog, Thread #2, and Var #1.  (KSTEP doesn't have any DACs).

    You would need to adjust the definition:

    #define RPM_FACTOR 500.0 // RPM for full duty cycle (max analog out)

    to get the proper commanded speed.  Set this to whatever speed your Spindle runs at when the "pot" is at full.

    To run closed loop would need a different approach and and a way to get the Spindle Position into KFLOP.  KFLOP expects an A B Quadrature type of signal connected to a hardware encoder input to easily monitor Spindle Position in order to report actual speed.  Can your motor driver output a quadrature signal?  If not you may be able to count the pulses in software if they are not too short.  KFLOP programs (with 2 active User Threads) are guaranteed to execute every 270us.  So the pulse must be at least that long at the highest possible speed to be counted reliably.  I've attached a program that you might test to count pulses into KFLOP's Axis 4 Position Variable.

    HTH
    Regards
    TK